<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../../template/defaultMenuTemplate.xhtml">
	<ui:define name="content">
		<h:form id="productForm" style="text-space-collapse: preserve">
			<h:panelGrid columns="2" width="100%" cellpadding="0" cellspacing="0" columnClasses="panelGrid">
				<rich:panel style=" padding: 1px;width: 375px;" bodyClass="inpanelBody">
					<f:facet name="header">
						<h:outputText value="#{BundleLabels.register_product}"/>
					</f:facet>
					<h:outputText value="#{BundleLabels.name}"/>
					<h:message showDetail="false" for="name" errorStyle="color: red" infoStyle="color: green"/>
					<h:inputText id="name" value="#{productController.productTO.name}"
					             required="true" validatorMessage="#{BundleLabels.validateInputEmpty}">
						<!--<f:ajax render="clientOnServerSide" execute="@this"/>-->
					</h:inputText>
					<br/>

					<h:outputText value="#{BundleLabels.description}"/>
					<h:message showDetail="false" for="description" errorStyle="color: red" infoStyle="color: green"/>
					<h:inputText id="description" value="#{productController.productTO.description}"
					             required="false">
					</h:inputText>
					<br/>

					<h:outputText value="#{BundleLabels.type_product}"/>
					<h:message for="typeProduct" errorStyle="color: red" infoStyle="color: green"/>
					<h:selectOneMenu id="typeProduct" value="#{productController.productTO.typeProduct}"
					                 required="true">
						<f:selectItem itemValue="SERVICE" itemLabel="#{BundleLabels.service}"/>
						<f:selectItem itemValue="PACKAGE" itemLabel="#{BundleLabels.package_product}"/>
						<f:selectItem itemValue="SIMPLE" itemLabel="#{BundleLabels.simple}"/>
					</h:selectOneMenu>
					<br/>
					<h:outputText value="#{BundleLabels.active}"/>
					<h:message for="isActive" errorStyle="color: red" infoStyle="color: green"/>
					<h:selectBooleanCheckbox id="isActive" value="#{productController.productTO.isActive}"/>
					<br/>
					<h:commandButton action="#{productController.saveProduct}" value="#{BundleLabels.btn_register}"/>
				</rich:panel>
				<rich:panel style=" padding: 1px;width: 375px;" bodyClass="inpanelBody">
					<rich:dataTable width="300px" id="carList" rows="10" columnClasses="col"
					                value="#{productController.allProduct}" var="product">
						<f:facet name="header">
							<rich:columnGroup>
								<h:column>
									<h:outputText styleClass="headerText" value="#{BundleLabels.name}"/>
								</h:column>
								<h:column>
									<h:outputText styleClass="headerText" value="#{BundleLabels.description}"/>
								</h:column>
								<h:column>
									<h:outputText styleClass="headerText" value="#{BundleLabels.type}"/>
								</h:column>
								<h:column>
									<h:outputText styleClass="headerText" value="#{BundleLabels.active}"/>
								</h:column>
								<h:column>
									<h:outputText styleClass="headerText" value="#{BundleLabels.createDate}"/>
								</h:column>
							</rich:columnGroup>
						</f:facet>
						<h:column>
							<h:outputText value="#{product.name}"/>
						</h:column>
						<h:column>
							<h:outputText value="#{product.description}"/>
						</h:column>
						<h:column>
							<h:outputText value="#{product.typeProduct}"/>
						</h:column>
						<h:column>
							<h:outputText value="#{product.isActive}"/>
						</h:column>
						<h:column>
							<h:outputText value="#{product.createTime}"/>
						</h:column>
					</rich:dataTable>
				</rich:panel>
			</h:panelGrid>
		</h:form>
	</ui:define>
</ui:composition>
</html>
